package com.cdutetc.websocketTest.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cdutetc.websocketTest.service.DataService;

import lombok.RequiredArgsConstructor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@RestController
@RequestMapping("/api")
public class DataController {
    @Autowired
    private DataService dataService;

    @PostMapping("/trigger")
    public String triggerData(@RequestBody String event) {
        dataService.sendTriggeredData(event);
        return "数据已触发"+event;
    }
    
    
}
